package com.topmap.error;

/**
 * @Author: MaHuadong
 * @Date: 2019/7/17 12:55
 * @Version 1.0
 */
public enum EmBusinessError implements CommonError {

    //通用错误类型00001
    PARAMETER_VALIDATION_ERROR(40001,"参数不合法"),
    //通用错误类型00001
    UNKNOW_ERROR(40002,"未知错误"),

    //10000开头为用户信息相关错误定义
    USER_NOT_EXIT(10001,"用户不存在"),

    USER_LOGIN_FAIL(20002,"用户手机号或密码不正确"),

    USER_NOT_LOGIN(20003,"用户还未登录"),

    //30000开头为交易信息错误定义
    STOCK_NOT_ENOUGH(30001,"库存不足"),


    //如果还有别的错误信息。可以直接在这儿继续写就ok。。。
    ;


    //构造函数
    private EmBusinessError(int errCode,String errMsg){
        this.errCode=errCode;
        this.errMsg=errMsg;

    }

    private int errCode;
    private String errMsg;
    @Override
    public int getErrorCode() {
        return this.errCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrorMsg(String errMsg) {
        this.errMsg=errMsg;
        return this;
    }
}
